<%@page import="com.wanmait.hotelManage.vo.RoomTypeComment"%>
<%@page import="com.wanmait.hotelManage.vo.Roomimages"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="com.wanmait.hotelManage.vo.RoomType"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
	String path=request.getContextPath();
String endTime=(String)request.getAttribute("endTime");
String startTime=(String)request.getAttribute("startTime");
String f=(String)request.getAttribute("msg");
List<RoomType> roomTypes=(List<RoomType>)request.getAttribute("roomTypes");
List<Roomimages>images=(List<Roomimages>)request.getAttribute("images");
ArrayList<RoomTypeComment>roomTyepComments=(ArrayList<RoomTypeComment>)request.getAttribute("roomTypeComments");
Integer sum=(Integer)request.getAttribute("sum");
%>
<div class="rooms-details-content">
    					<div class="img-box">
    					<%
    					if(images!=null){
    					%>
    						<figure><img id="img" style="width:770px;height:520px" src="static/images/rooms/<%=images.get(0).getPic() %>" alt=""></figure>
    						 <div id="list">
    				<span>		 <img id="img0" style="width:192px;height:146px" src="static/images/rooms/<%=images.get(0).getPic() %>" alt=""></span>
    				<span>		 <img id="img1" style="width:192px;height:146px" src="static/images/rooms/<%=images.get(1).getPic() %>" alt=""></span>
    				<span>		 <img id="img2" style="width:193px;height:146px" src="static/images/rooms/<%=images.get(2).getPic() %>" alt=""></span>
    				<span>		 <img id="img3" style="width:193px;height:146px" src="static/images/rooms/<%=images.get(3).getPic() %>" alt=""></span>
    						 </div>
    					<%
    					}
    					%>
    					</div>
    					<%RoomType roomType=(RoomType)request.getAttribute("roomType"); %>
    					<!--房间详情-->
    					<div id="aa"></div>
    					<input id="roomType" type="hidden" value="<%=roomType.getTitle()%>">
    					<div class="lower-content">
    						<h2><%=roomType.getTitle() %></h2>
    						<div class="text"><span style="text-decoration: line-through;"><%=roomType.getPrice() %>元</span> / 原价</div>
    						<div class="text"><span><%=roomType.getDiscountPrice() %> 元</span> / 现价</div>
    						<ul class="rating">
    							<li><i class="fa fa-star" aria-hidden="true"></i></li>
    							<li><i class="fa fa-star" aria-hidden="true"></i></li>
    							<li><i class="fa fa-star" aria-hidden="true"></i></li>
    							<li><i class="fa fa-star" aria-hidden="true"></i></li>
    							<li><i class="fa fa-star" aria-hidden="true"></i></li>
    						</ul>
    						
    						<div style=""><%=roomType.getDescription() %></div>
    					
    					</div>
    					<!--房间信息-->
    					<div class="rooms-catagori">
    						<h3>房间 详情</h3>
    						<div class="row">
    							<div class="col-md-4 col-sm-4 col-xs-12">
    								<ul class="list">
    									<li>WIFI</li>
    									<li>空调</li>
    									<li>厨房</li>
    								</ul>
    							</div>
    						</div>
    					</div>
    					<!--客户评论-->
    					<div class="client-reviews">
    						<h3>客户评论</h3>
    						<div class="default-form">
		                      
		                    </div>
    					 <!--所有评论-->
                        <div class="comment-area">
                            <div class="comment-title"><h3>评论 (<%=sum %>)</h3></div>
                            <%
                            if(roomTyepComments!=null){
                            	for(int i=0;i<roomTyepComments.size();i++){
                            		RoomTypeComment roomTypeComment=roomTyepComments.get(i);
                            		%>
                                 <div style="margin-top:-10px;font-family:SimHei;font-size:20px" class="comment-name"><%=roomTypeComment.getUserinfo().getUsername() %>
                                  <a id="spana" data-id="<%=roomTypeComment.getId() %>" href="javascript:void(0)">举报</a></div>&nbsp;&nbsp; <span style="font-family:SimHei;font-size:20px"><%=roomTypeComment.getContent() %></span>
                              <%
                            	}
                            }
                            %>
                       
    					</div>
    					
    				</div>
   <style>
  #list {
    float: left;
    font-size:0
  }
  #aa{
    height:150px;
  }
  #list span{
    /* margin-left:40px */
  }
 </style>
 <script>
	 var imgs=["static/images/rooms/<%=images.get(0).getPic() %>","static/images/rooms/<%=images.get(1).getPic() %>",
		 "static/images/rooms/<%=images.get(2).getPic() %>","static/images/rooms/<%=images.get(3).getPic() %>"];
	 $(function(){
		  var xc=setInterval(go,2000); 
		  $("#img2").mouseover(function(){
              var s=$(this).attr("src");
              $("#img").attr("src",s);
              clearInterval(xc);
          })
          $("#img2").mouseout(function(){
              var s=$(this).attr("src");
              $("#img").attr("src",s);
              
              xc=setInterval(go,2000);
          })
          $("#img3").mouseover(function(){
              
              var s=$(this).attr("src");
              $("#img").attr("src",s);
              clearInterval(xc);
          })
          $("#img3").mouseout(function(){
              var s=$(this).attr("src");
              $("#img").attr("src",s);
              xc=setInterval(go,2000);
          })
           $("#img1").mouseover(function(){
              
              var s=$(this).attr("src");
              $("#img").attr("src",s);
              clearInterval(xc);
          })
          $("#img1").mouseout(function(){
              var s=$(this).attr("src");
              $("#img").attr("src",s);
              xc=setInterval(go,2000);
          })
           $("#img0").mouseover(function(){
              
              var s=$(this).attr("src");
              $("#img").attr("src",s);
              clearInterval(xc);
          })
          $("#img0").mouseout(function(){
              var s=$(this).attr("src");
              $("#img").attr("src",s);
              xc=setInterval(go,2000);
          })
           $("#spana").click(function(){
			 if(!window.confirm("确定要举报吗")){
				 return false;
			 }
			 var id=$(this).data("id");
			 $.ajax({
				 url:"<%=path%>/roomListServlet?action=de",
					 data:{id:id},
						 success:function(msg){
							 if(msg=="ok"){
						 alert("举报成功,请等待管理员审批")
					 }else if(msg=="no"){
						 window.location.href="<%=path%>/login.jsp";
					 }
						 }
			 })
		 })
 })
/*  function go(){
		 var src=$("#img").attr("src");
		 for(var i=0;i<imgs.length;i++){
			 if(src==imgs[i]){
				 if(i==3){
					 $("#img").attr("src",imgs[0]);
				 }else{
					 $("#img").attr("src",imgs[i+1]);
				 }
			 }
		 }
	 } */
 </script>